#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
using namespace std;

#define ROW 10
#define COL 10
int main()
{

	int N = 0;
	int M = 0;
	int Q = 0;
	scanf("%d %d %d", &N, &M, &Q);

	int game[ROW][COL] = { 0 };
	while (Q--)
	{
		int T = 0;
		int C = 0;
		scanf("%d %d", &T, &C);

		if (T == 0)
		{
			for (int i = 0; i < M; i++)
			{
				game[C][i] = 1;
			}
		}
		else
		{
			for (int i = 0; i < N; i++)
			{
				game[i][C] = 1;
			}
		}	
	}

	int count = 0;
	for (int i = 0; i < N; i++)
	{
		for (int j = 0; j < M; j++)
		{
			if (game[i][j] == 0)
			{
				count++;
			}
		}
	}

	printf("%d", count);

	return 0;
}
